﻿#ifndef DESCRIPTION_H
#define DESCRIPTION_H

#include <QObject>
#include <QXmlStreamWriter>
#include "device.h"
#include "objectfactory.h"
#include "step.h"


class Description : public QObject
{
    Q_OBJECT
public:
    Description();

private:
    QList<Device *>     m_pDevices;
    QList<Step *>       m_pSteps;
    bool                m_isAllInitialized;

public:
    Device *FindDeviceById(QString strID);
public:
    void clear();

public:
    void AddDevice(Device *pDevice) { m_pDevices.append(pDevice); }
    void AddStep(Step *pStep) { m_pSteps.append(pStep); }

public:
    bool writeXML(const QString &filePath);
    bool ReadXML(const QString &filePath);

    void initAllDevices();
    void uninitAllDevices();
    void run();
    void test();
    QList<Device *> pDevices() const;
    QList<Step *> pSteps() const;

public slots:
    // 接收到虚拟设备的命令
    void ReceviceCmdFromVirtualDevice(QVariant variant);

signals:
    void SendCmdToMainWindow(QVariant variant);
};

#endif // DESCRIPTION_H
